home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1990 December / 1990-12.d64 / high voltage (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  166 lines

  1. 1 rem copyright 1990, compute publications int'l, ltd. all rights reserved.
  2. 10 v=53248:pokev,0:pokev+1,0:pokev+21,3:pokev+23,0:pokev+29,0:poke53287,1
  3. 20 poke2040,13:x=rnd(-ti)
  4. 30 fori=832toi+63:pokei,0:next
  5. 40 fori=836to886step3:pokei,28:next
  6. 50 fori=859to864:pokei,255:next
  7. 60 x=11:print"[147]";:poke53280,0:poke53281,0
  8. 70 dimv$(25),t(x,x)
  9. 80 v$(0)="":fori=1to24:v$(i)=v$(i-1)+"":next
  10. 90 gosub1170:gosub1380:printv$(17)tab(26)"[159]wiring board"
  11. 100 printtab(26)"please wait..."
  12. 110 y1=1:y2=x
  13. 120 x1=int(rnd(1)*x)+1
  14. 130 t(y1,x1)=2:o1=x1:u1=y1
  15. 140 xx=int(rnd(1)*5)+4
  16. 150 ifxx=4thenx1=x1-1
  17. 160 ifxx=5thenx1=x1+1
  18. 170 ifxx=6thenx1=x1-1:y1=y1+1
  19. 180 ifxx=7theny1=y1+1
  20. 190 ifxx=8theny1=y1+1:x1=x1+1
  21. 200 ifx1>xorx1<1ory1>xory1<1thenx1=o1:y1=u1:goto140
  22. 210 ift(y1,x1)=0ort(y1,x1)=2thent(y1,x1)=2:goto230
  23. 220 x1=o1:y1=u1:goto140
  24. 230 ify1<>xthen130
  25. 240 x2=int(rnd(1)*x)+1:ift(y2,x2)then240
  26. 245 ww=0:t(y2,x2)=5
  27. 250 o1=x2:u1=y2
  28. 260 xx=int(rnd(1)*5)+4
  29. 270 ifxx=4thenx2=x2-1
  30. 280 ifxx=5thenx2=x2+1
  31. 290 ifxx=6thenx2=x2-1:y2=y2-1
  32. 300 ifxx=7theny2=y2-1
  33. 310 ifxx=8theny2=y2-1:x2=x2+1
  34. 320 ifx2>xorx2<1ory2>xory2<1thenx2=o1:y2=u1:goto260
  35. 330 ift(y2,x2)=0thent(y2,x2)=5:goto370
  36. 340 ift(y2,x2)=2thenww=ww+1
  37. 350 ifww>5theny2=x:x2=int(rnd(1)*x)+1:goto240
  38. 360 x2=o1:y2=u1:goto260
  39. 370 ify2<>1then250
  40. 380 fori=1tox:forj=1tox:ift(i,j)=2ort(i,j)=5then420
  41. 390 ux=rnd(1):ifux<.2thent(i,j)=2:goto420
  42. 400 ifux>.8thent(i,j)=5:goto420
  43. 410 t(i,j)=0
  44. 420 nextj,i
  45. 430 s1=1:s2=1:t1=x:t2=x
  46. 440 poke198,0:pl=int(rnd(1)*2)+1
  47. 450 c=0:gosub1330
  48. 460 ifpl=2then710
  49. 470 u1=s1:u2=s2
  50. 480 a=s1:b=s2:poke53287,2:ifc>2then700
  51. 490 pokev,b*2*8+20:pokev+1,a*2*8+48:oa=a:ob=b
  52. 500 geta$
  53. 510 ifa$=""thenb=b+1:goto590
  54. 520 ifa$="[157]"thenb=b-1:goto590
  55. 530 ifa$="[145]"thena=a-1:goto590
  56. 540 ifa$=""thena=a+1:goto590
  57. 550 ifa$=chr$(13)then610
  58. 560 ifa$="[136]"thenpl=0:goto1040
  59. 570 u=peek(56320):gosub1580:ifa$<>""then510
  60. 580 goto500
  61. 590 ifa<1orb<1ora>xorb>xthena=oa:b=ob:goto490
  62. 600 goto490
  63. 610 if(s1=1anda>1)or(s1<>1)then630
  64. 620 s1=a:s2=b:goto650
  65. 630 ifabs(s1-a)>1orabs(s2-b)>1then490
  66. 640 s1=a:s2=b
  67. 650 pokev,0:pokev+1,0
  68. 660 i=s1:j=s2:gosub980:ift(i,j)=5then700
  69. 670 ift(i,j)=0thengosub1520:gosub950:s1=u1:s2=u2:c=c+1:goto470
  70. 680 gosub1500:gosub950:ifs1<xthen470
  71. 690 ww=1:goto1040
  72. 700 pl=2:s1=1:s2=1:fl=1:gosub1540:gosub950:goto450
  73. 710 v1=t1:v2=t2
  74. 720 a=t1:b=t2:poke53287,5:ifc>2then940
  75. 730 pokev,b*2*8+20:pokev+1,a*2*8+48:oa=a:ob=b
  76. 740 geta$
  77. 750 ifa$=""thenb=b+1:goto830
  78. 760 ifa$="[157]"thenb=b-1:goto830
  79. 770 ifa$=""thena=a+1:goto830
  80. 780 ifa$="[145]"thena=a-1:goto830
  81. 790 ifa$=chr$(13)then850
  82. 800 ifa$="[136]"thenpl=0:goto1040
  83. 810 u=peek(56320):gosub1580:ifa$<>""then750
  84. 820 goto740
  85. 830 ifa<1orb<1ora>xorb>xthena=oa:b=ob:goto730
  86. 840 goto730
  87. 850 if(t1=xanda<x)or(t1<>x)then870
  88. 860 t1=a:t2=b:goto890
  89. 870 ifabs(t1-a)>1orabs(t2-b)>1then730
  90. 880 t1=a:t2=b
  91. 890 pokev,0:pokev+1,0
  92. 900 i=t1:j=t2:gosub980:ift(i,j)=2then940
  93. 910 ift(i,j)=0thengosub1520:gosub950:t1=v1:t2=v2:c=c+1:goto710
  94. 920 gosub1500:gosub950:ift1<>1then710
  95. 930 ww=2:goto1040
  96. 940 pl=1:t1=x:t2=x:fl=1:gosub1540:gosub950:goto450
  97. 950 ifi=7thenprintv$(i*2-1)tab(40+j*2)"[176][174][157][157][173][189]":goto970
  98. 960 printv$(i*2)tab(j*2)"[176][174][157][157][173][189]";
  99. 970 return
  100. 980 ift(i,j)=2thenprint"";
  101. 990 ift(i,j)=5thenprint"";
  102. 1000 ift(i,j)=0thenprint"[144]";
  103. 1010 ifi=7thenprintv$(i*2-1)tab(40+j*2)"[213][201][157][157][202][203]";:goto1030
  104. 1020 printv$(i*2)tab(j*2)"[213][201][157][157][202][203]";
  105. 1030 return
  106. 1040 pokev+21,0:fori=1tox:forj=1tox:gosub980:nextj,i
  107. 1050 gosub1540:ifpl=0then1120
  108. 1060 printv$(10)tab(5)"[146][176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  109. 1070 printtab(5)"[221]               [221]"
  110. 1080 printtab(5)"[221] [158]the winner is [221]"
  111. 1090 printtab(5)"[221] [158]player #"pl:printv$(13)tab(17)" !  [221]"
  112. 1100 printtab(5)"[221]               [221]"
  113. 1110 printtab(5)"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  114. 1120 printv$(17)tab(26)"[146][159]press any key"
  115. 1130 printtab(26)"  or <fire> "
  116. 1140 printv$(19)tab(66)"to play again"
  117. 1150 geta$:u=peek(56320):ifa$<>""oru=111thenrun
  118. 1160 goto1150
  119. 1170 a1$="[151] ":a2$=a1$
  120. 1180 ta(1)=0:ta(2)=2:ta(3)=5
  121. 1190 fori=1to11:a1$=a1$+"[176][174]":next
  122. 1200 aa$=aa$+"[151] "+chr$(13)+" [154]"
  123. 1210 fori=1to11:a2$=a2$+"[173][189]":next
  124. 1220 gosub1290:gosub1380:gosub1540
  125. 1230 printv$(17)tab(26)"[159]press any key"
  126. 1240 printtab(26)"to begin..."
  127. 1250 i=int(rnd(1)*11)+1:j=int(rnd(1)*11)+1:t(i,j)=ta(int(rnd(1)*3)+1)
  128. 1260 gosub980:t(i,j)=0:geta$:u=peek(56320):ifa$<>""oru=111then1280
  129. 1270 goto1250
  130. 1280 gosub1290:return
  131. 1290 print"[147][151]";
  132. 1300 fori=1to12:print"  ";:next:print
  133. 1310 fori=1to11:printa1$"[151] ":printa2$"[151] ":next
  134. 1320 print"[151]";:fori=1to12:print"  ";:next:return
  135. 1330 printv$(17)tab(26)"[146][176][192][192][192][192][192][192][192][192][192][192][174]"
  136. 1340 printtab(26)"[221]";:print"";:ifpl=2thenprint"";
  137. 1350 print" player"pl:printv$(18)tab(36)" [221]  "
  138. 1360 printv$(19)tab(66)"[146][173][192][192][192][192][192][192][192][192][192][192][189]":return
  139. 1370 printv$(3)tab(28)"[146] [169]     [223]"
  140. 1380 h=26:printv$(3)tab(h)"[146]      [158][169]   [146][169]"
  141. 1390 printtab(h)"     [169]   [146][169]"
  142. 1400 printtab(h)"    [169]   [146][169]"
  143. 1410 printtab(h)"     [169]  [146][169]"
  144. 1420 printtab(h)"    [169]  [146][169]"
  145. 1430 printtab(h)"   [169]  [146][169]"
  146. 1440 printtab(h)"    [169] [146][169]"
  147. 1450 printtab(h)"   [169] [146][169]"
  148. 1460 printtab(h)"  [169] [146][169]"
  149. 1470 printtab(h)"  [169][146][169]"
  150. 1480 printtab(h)" [169][146][169]"
  151. 1490 printv$(9)tab(26)"[158][146]high[169][146]voltage!":return
  152. 1500 poke54273,70:poke54278,249:poke54296,15:poke54276,17:poke54276,16
  153. 1510 fordy=1to500:next:poke54273,0:return
  154. 1520 forp=1to15:poke54296,15:poke54296,0:next:return
  155. 1530 forb=1to250step3:poke54273,b:next:poke54296,0:fl=0:return
  156. 1540 forp=54272to54295:pokep,0:next:poke54296,15
  157. 1550 poke54277,8:poke54278,255:poke54276,23:a=6:poke54287,a:ifflthen1530
  158. 1560 forb=1to150:poke54273,b:a=a-.01:next
  159. 1570 gosub1500:poke54296,0:return
  160. 1580 a$="":ifu=111thena$=chr$(13)
  161. 1590 ifu=119thena$=""
  162. 1600 ifu=123thena$="[157]"
  163. 1610 ifu=126thena$="[145]"
  164. 1620 ifu=125thena$=""
  165. 1630 return
  166.